﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Editxncstime.aspx.cs" Inherits="Rep_Editxncstime" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>参数维护</title>
    <link href="../css/SIS.css" rel="stylesheet" type="text/css" />

    <script language="javascript" type="text/javascript" src="../My97DatePicker/WdatePicker.js"></script>

    <script language="javascript" type="text/javascript" src="../Js/Excel.js"></script>

    <script src="../Js/jquery-1.6.2.js" type="text/javascript"></script>

    <script type="text/javascript" language="javascript">

        $(document).ready(function(){
            var myDate = new Date();
            $("#txtDate").val(myDate.toLocaleDateString().replace('年','-').replace('月','-').replace('日',''));
            getready();
            $("#btnEdit").click(function() {               
               edit();
            });   
            $("#btnSearch").click(function() {               
              getready();
            });  
        });
        
        function edit(){
            var count=parseInt( $("#count").val());
            var name='';
            var unit='';
            var value='';
            var num='';
            var key='';
            for(var i=0;i<count;i++){
                name+=$("#name"+i).html()+';';    
                unit+= $("#unit"+i).val()+';';   
                value+=parseFloat($("#value"+i).val())+';';
                num+=$("#num"+i).html()+';';
                key+=$("#key"+i).html()+';';
            }
            $.post("Editxncstime.aspx", { param: 'search', time: $("#txtDate").val(),name:encodeURIComponent(name),unit:unit,value:value,num:num,key:key,bc:$("#bc").val()}, function (data) { 
                alert(data.tableInfo);     
            }, 'json');
        }
        
        function getready(){
                       //$("#btnEdit").hide();
            $.post("Editxncstime.aspx", { param: 'query', time: $("#txtDate").val(),bc:$("#bc").val()}, function (data) {
                var judge=data.judge;
                if(judge==''||judge==null)
                {
                    $("#dvEdit").hide();                    
                    alert('请先登陆!');                     
                }else{
                    $("#dvShow").html(data.tableInfo);
                    $("#count").val(data.count);
                    $("#dvEdit").show();
                }
            }, 'json');
        }

    </script>

</head>
<body>
    <form id="form1" runat="server">
    <div style="width: 85%;">
        <table style="width: 90%;">
            <tr>
                <td align="left" valign="middle" colspan="2">
                    <img src="../img/cswhtop.jpg" />
                </td>
            </tr>
            <tr>
                <td align="left" valign="middle">
                    &nbsp; &nbsp
                    <label id="lalStime" style="height: 30px;" runat="server" class="td_title">
                        查询日期:</label>
                    &nbsp; &nbsp; &nbsp;
                    <input type="text" id="txtDate" style="text-align: center;" runat="server" readonly="readonly"
                        onfocus="WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd'})" class="Wdate" />
                    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 班次:&nbsp;
                    <select id="bc" runat="server">
                        <option id="Option0" value="0">早</option>
                        <option id="Option1" value="1">中</option>
                        <option id="Option2" value="2">晚</option>
                    </select>
                    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                    <input id="btnSearch" type="button" value="查  询" style="height: 22px" class="nvinput" />
                </td>
            </tr>
        </table>
    </div>
    <div id="dvShow">
    </div>
    <div id="dvEdit">
        <input id="btnEdit" type="button" value="确    定" style="height: 22px" class="nvinput" />
    </div>
    <input id="count" type="hidden" />
    </form>
</body>
</html>
